<?php

declare(strict_types=1);

namespace app\validate\admin;

use think\Validate;

class AuthRulesValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => 'max:2147483647|min:0|integer|require',
        'pid' => 'max:2147483647|min:0|integer',
        'title' => 'max:60|require',
        'link' => 'max:150',
        'icon' => 'max:150',
        'code' => 'max:32|require',
        'sort' => 'max:32767|min:0|integer',
        'status' => 'max:123|min:0|integer',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [];

    /**
     * 定义场景，验证不同场景的数据
     */
    protected $scene = [
        'save'  =>  ['pid', 'title', 'link', 'icon', 'code', 'sort', 'status'],
        'update' => ['id', 'pid', 'title', 'link', 'icon', 'code', 'sort', 'status'],
    ];
}
